package com.isp.common.model.enums;

import com.isp.common.model.ResultCode;

/**
 * ResultCodeEnum
 *
 * @author Linsy
 * @version 1.0
 * @created 2024/6/20 11:25 AM
 */
public enum SystemCodeEnum implements ResultCode {
    /**
     * 系统异常
     */
    SUCCESS(200, "默认成功"),
    ERROR(-1, "系统异常"),
    FAILED(1001, "失败"),
    SERVER_ERROR(1002, "服务器开小差了"),
    METHOD_WITHOUT_IMPLEMENT(1003, "该方法暂未实现"),
    RESP_FIELD_VALID(1004, "返回值字段校验失败"),
    DB_ERROR(1005, "数据库调用失败"),
    BUSINESS_LOGIC_ERROR(1006, "业务逻辑失败"),
    JSON_PARSE_FAILED(1007, "json转换异常"),
    FILE_IO_FAILED(1008, "文件读写异常"),
    PARAMETER_MISSING(1009, "参数缺失"),
    UN_AUTH(1010, "用户未登陆"),

    /**
     * 2000-2999 通用的后端业务检查异常，是正常的返回值
     */
    PARAM_ERROR(2001, "参数错误"),
    SYNC_OP_ERROR(2002, "操作频繁，请稍后再试"),
    SENSITIVE_WORD(2003, "存在敏感词汇"),
    SPRING_REQUEST_RESOLVER(2004, "非法的请求参数格式"),
    OLD_VERSION(2005, "当前版本太低了，请下载最新版本应用"),
    REQUEST_FREQ_RESTRICT(2006, "接口访问频率超出限制"),
    AUTHORITY_EXCEED(2007, "越权访问"),
    ILLEGAL_REQUEST_SOURCE(2008, "不合法的请求来源"),
    EOF_BROKEN_PIPE(2009, "客户端主动断开连接"),
    EXIST_RISK(2010, "存在风险"),
    DATA_NOT_EXIST(2011, "数据不存在"),
    // 一般用于查询到的数据状态和预期不匹配时，比如 上下线
    STATUS_UNEXPECTED(2012, "数据状态不正确"),
    // 一般用于查询到的数据内容和预期不匹配时，比如 字段内容为空
    CONTENT_UNEXPECTED(2013, "数据内容不正确"),
    INVALID_DATA_ACCESS_RESOURCE(2014, "无效的数据资源访问")

    ;

    private final Integer code;
    private final String msg;

    SystemCodeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Integer getRet() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.msg;
    }
}
